package towerDefense.projectiles;

import java.awt.image.BufferedImage;
import towerDefense.units.ValuedSprite;
import com.golden.gamedev.object.Sprite;


public class ProjectileSprite extends TrackingSprite
{

    public double getDamage ()
    {
        return myDamage;
    }


    public void setDamage (double dam)
    {
        this.myDamage = dam;
    }

    protected double myDamage;


    public ProjectileSprite (BufferedImage image,
                             double x,
                             double y,
                             double r,
                             Sprite s,
                             double spd,
                             double dam)
    {
        super(image, x, y, r, spd, s);
        myDamage = dam;
    }


    public ProjectileSprite (BufferedImage image,
                             double r,
                             Sprite s,
                             double spd,
                             double dam)
    {
        super(image, r, spd, s);
        myDamage = dam;
    }


    public ProjectileSprite (Sprite s,
                             double x,
                             double y,
                             ProjectileQualities pq)
    {
        this(pq.getImage(),
             x,
             y,
             pq.getAOERadius(),
             s,
             pq.getSpeed(),
             pq.getDamage());
    }


    @Override
    public void doHitTarget ()
    {
        this.setActive(false);
        ((ValuedSprite) myTarget).decreaseHP(myDamage);
    }

}
